using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using Data.Models.Mapping;

namespace Data.Models
{
    public partial class QuanLySanXuatContext : DbContext
    {
        static QuanLySanXuatContext()
        {
            Database.SetInitializer<QuanLySanXuatContext>(null);
        }

        public QuanLySanXuatContext()
            : base("Name=QuanLySanXuatContext")
        {
        }
        public virtual void Commit()
        {
            base.SaveChanges();
        }
        public DbSet<Accessory> Accessories { get; set; }
        public DbSet<ActualGoodInStock> ActualGoodInStocks { get; set; }
        public DbSet<BillDetail> BillDetails { get; set; }
        public DbSet<BillOut> BillOuts { get; set; }
        public DbSet<BOMAccessorie_Details> BOMAccessorie_Details { get; set; }
        public DbSet<BOMDetail> BOMDetails { get; set; }
        public DbSet<BOMMachine_Details> BOMMachine_Details { get; set; }
        public DbSet<BOM> BOMS { get; set; }
        public DbSet<BOMWorker_Details> BOMWorker_Details { get; set; }
        public DbSet<Category> Categories { get; set; }
        public DbSet<Company> Companies { get; set; }
        public DbSet<Contact> Contacts { get; set; }
        public DbSet<CostDetail> CostDetails { get; set; }
        public DbSet<Currency> Currencies { get; set; }
        public DbSet<DesignDetail> DesignDetails { get; set; }
        public DbSet<Employee> Employees { get; set; }
        public DbSet<LabourDetail> LabourDetails { get; set; }
        public DbSet<LabourFormula> LabourFormulas { get; set; }
        public DbSet<LevelNorm> LevelNorms { get; set; }
        public DbSet<Machine> Machines { get; set; }
        public DbSet<MaterialDetail> MaterialDetails { get; set; }
        public DbSet<MaterialFormula> MaterialFormulas { get; set; }
        public DbSet<Material> Materials { get; set; }
        public DbSet<MaterialType> MaterialTypes { get; set; }
        public DbSet<OrderProcess> OrderProcesses { get; set; }
        public DbSet<Order> Orders { get; set; }
        public DbSet<OrderSummary> OrderSummaries { get; set; }
        public DbSet<OtherCost> OtherCosts { get; set; }
        public DbSet<OtherCostDetail> OtherCostDetails { get; set; }
        public DbSet<OtherCostFormula> OtherCostFormulas { get; set; }
        public DbSet<Product> Products { get; set; }
        public DbSet<ProductComplete_Details> ProductComplete_Details { get; set; }
        public DbSet<ProductComplete> ProductCompletes { get; set; }
        public DbSet<ProductModel> ProductModels { get; set; }
        public DbSet<ProductProcess> ProductProcesses { get; set; }
        public DbSet<ProductType> ProductTypes { get; set; }
        public DbSet<PurchaseDetail> PurchaseDetails { get; set; }
        public DbSet<Purchase> Purchases { get; set; }
        public DbSet<Stock> Stocks { get; set; }
        public DbSet<StorageDetail> StorageDetails { get; set; }
        public DbSet<SubprocessDetail> SubprocessDetails { get; set; }
        public DbSet<ToolDetail> ToolDetails { get; set; }
        public DbSet<ToolFormula> ToolFormulas { get; set; }
        public DbSet<ToolNorm> ToolNorms { get; set; }
        public DbSet<ToolType> ToolTypes { get; set; }
        public DbSet<Unit> Units { get; set; }
        public DbSet<UOM> UOMs { get; set; }
        public DbSet<User> Users { get; set; }
        public DbSet<WorkerLevel> WorkerLevels { get; set; }
        public DbSet<WorkerType> WorkerTypes { get; set; }
        public DbSet<Workplace> Workplaces { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Configurations.Add(new AccessoryMap());
            modelBuilder.Configurations.Add(new ActualGoodInStockMap());
            modelBuilder.Configurations.Add(new BillDetailMap());
            modelBuilder.Configurations.Add(new BillOutMap());
            modelBuilder.Configurations.Add(new BOMAccessorie_DetailsMap());
            modelBuilder.Configurations.Add(new BOMDetailMap());
            modelBuilder.Configurations.Add(new BOMMachine_DetailsMap());
            modelBuilder.Configurations.Add(new BOMMap());
            modelBuilder.Configurations.Add(new BOMWorker_DetailsMap());
            modelBuilder.Configurations.Add(new CategoryMap());
            modelBuilder.Configurations.Add(new CompanyMap());
            modelBuilder.Configurations.Add(new ContactMap());
            modelBuilder.Configurations.Add(new CostDetailMap());
            modelBuilder.Configurations.Add(new CurrencyMap());
            modelBuilder.Configurations.Add(new DesignDetailMap());
            modelBuilder.Configurations.Add(new EmployeeMap());
            modelBuilder.Configurations.Add(new LabourDetailMap());
            modelBuilder.Configurations.Add(new LabourFormulaMap());
            modelBuilder.Configurations.Add(new LevelNormMap());
            modelBuilder.Configurations.Add(new MachineMap());
            modelBuilder.Configurations.Add(new MaterialDetailMap());
            modelBuilder.Configurations.Add(new MaterialFormulaMap());
            modelBuilder.Configurations.Add(new MaterialMap());
            modelBuilder.Configurations.Add(new MaterialTypeMap());
            modelBuilder.Configurations.Add(new OrderProcessMap());
            modelBuilder.Configurations.Add(new OrderMap());
            modelBuilder.Configurations.Add(new OrderSummaryMap());
            modelBuilder.Configurations.Add(new OtherCostMap());
            modelBuilder.Configurations.Add(new OtherCostDetailMap());
            modelBuilder.Configurations.Add(new OtherCostFormulaMap());
            modelBuilder.Configurations.Add(new ProductMap());
            modelBuilder.Configurations.Add(new ProductComplete_DetailsMap());
            modelBuilder.Configurations.Add(new ProductCompleteMap());
            modelBuilder.Configurations.Add(new ProductModelMap());
            modelBuilder.Configurations.Add(new ProductProcessMap());
            modelBuilder.Configurations.Add(new ProductTypeMap());
            modelBuilder.Configurations.Add(new PurchaseDetailMap());
            modelBuilder.Configurations.Add(new PurchaseMap());
            modelBuilder.Configurations.Add(new StockMap());
            modelBuilder.Configurations.Add(new StorageDetailMap());
            modelBuilder.Configurations.Add(new SubprocessDetailMap());
            modelBuilder.Configurations.Add(new ToolDetailMap());
            modelBuilder.Configurations.Add(new ToolFormulaMap());
            modelBuilder.Configurations.Add(new ToolNormMap());
            modelBuilder.Configurations.Add(new ToolTypeMap());
            modelBuilder.Configurations.Add(new UnitMap());
            modelBuilder.Configurations.Add(new UOMMap());
            modelBuilder.Configurations.Add(new UserMap());
            modelBuilder.Configurations.Add(new WorkerLevelMap());
            modelBuilder.Configurations.Add(new WorkerTypeMap());
            modelBuilder.Configurations.Add(new WorkplaceMap());
        }
    }
}
